var net = function () {
    return new Net();
};

var Net = function () {

}

Net.prototype.url = function (url) {
    this.url = url;
    return this;
}

Net.prototype.data = function (data) {
    this.data = data;
    return this;
}

Net.prototype.success = function (success) {
    this.success = success;
    return this;
}

Net.prototype.error = function (error) {
    this.error = error;
    return this;
}

Net.prototype.post = function () {
    $.ajax({
        type: 'POST',
        url: this.url,
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        data: JSON.stringify(this.data),
        success: this.success,
        error: this.error
    });
}

Net.prototype.get = function () {
    $.ajax({
        type: 'GET',
        url: this.url,
        contentType: 'application/json; charset=utf-8',
        success: this.success,
        error: this.error
    });
}

Net.prototype.delete = function () {
    $.ajax({
        type: 'DELETE',
        url: this.url,
        contentType: 'application/json; charset=utf-8',
        success: this.success,
        error: this.error
    });
}

Net.prototype.put = function () {
    $.ajax({
        type: 'PUT',
        url: this.url,
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        data: JSON.stringify(this.data),
        success: this.success,
        error: this.error
    });
}